﻿#ifndef CDATABASE_H
#define CDATABASE_H

#include <QObject>
#include "sqlite.hpp"
#include <QSharedPointer>
#include <dbng.hpp>
#include <QString>
#include <string>

namespace DB
{
    struct course
    {
        std::string Monday;
        std::string Tuesday;
        std::string Wed;
        std::string Thursday;
        std::string Friday;
    };

    REFLECTION(course,Monday,Tuesday,Wed,Thursday,Friday);

    struct students
    {
        int ID;
        std::string name;
        std::string sex;
        int age;
        int chinese;
        std::string chinese_time;
        int math;
        std::string math_time;
        int english;
        std::string english_time;
    };

    REFLECTION(students,ID,name,sex,age,chinese,chinese_time,math,math_time,english,english_time);
};


using namespace ormpp;

class CDataBase : public QObject
{
    Q_OBJECT

    QSharedPointer<dbng<sqlite>>m_db;
public:
    CDataBase(QObject *parent = nullptr);
    ~CDataBase();
    //返回总数据库的指针
    QSharedPointer<dbng<sqlite>> getDB();
};

#endif // CDATABASE_H
